2.部署NameServer

mkdir -p /xb/rocketmq/data/namesrv
chmod 777 -R /xb/rocketmq/data/namesrv  # 确保配置文件权限正确


docker run -d --name mq-namesrv -p 9876:9876 --restart always -e "JAVA_OPTS=-Xms256m -Xmx512m" -v /data/namesrv/logs:/root/logs -v /data/namesrv/store:/root/store apache/rocketmq:5.3.3 sh mqnamesrv



3.‌配置并启动Broker

先创建配置文件
mkdir -p /xb/rocketmq/data/broker/conf
chmod 777 -R /xb/rocketmq/data/broker/conf  # 确保配置文件权限正确
编辑配置文件
vim /xb/rocketmq/data/broker/conf/broker.conf


namesrvAddr = 192.168.63.161:9876
brokerName = broker
brokerIP1 = 192.168.63.161
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
autoCreateTopicEnable=true
autoCreateSubscriptionGroup=true

启动Broker容器：

docker run -d --name mq-broker  --restart always -e "JAVA_OPTS=-Xms1g -Xmx2g" -p 10911:10911 -p 10909:10909 -p 10912:10912 -v /xb/rocketmq/data/broker/logs:/root/logs -v /xb/rocketmq/data/broker/store:/root/store -v /xb/rocketmq/data/broker/conf/broker.conf:/home/rocketmq/rocketmq-5.3.3/conf/broker.conf apache/rocketmq:5.3.3 sh mqbroker -c /home/rocketmq/rocketmq-5.3.3/conf/broker.conf -n 192.168.63.161:9876



4.‌启动控制台容器‌


docker run -d --name mq-dashboard --restart always -p 8082:8080 \
  --ulimit nofile=65536:65536 \
  -e "JAVA_OPTS=-Xms512m -Xmx512m" \
  -e "JAVA_OPTS=-Drocketmq.namesrv.addr=192.168.63.161:9876" \
  apacherocketmq/rocketmq-dashboard:1.0.0
